-
-
Notifications
You must be signed in to change notification settings - Fork 846
Block insecure connection on the WebView #6103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/onboarding_set_security_level_migration
Are you sure you want to change the base?
Block insecure connection on the WebView #6103
Conversation
Test Results 89 files + 2 89 suites +2 7m 31s ⏱️ -15s For more details on these failures, see this check. Results for commit fe0b2a9. ± Comparison against base commit bfecbf7. ♻️ This comment has been updated with latest results. |
| * @param url The URL being used for the connection | ||
| * @return [SecurityStatus.Secure] if the connection is secure, [SecurityStatus.Insecure] otherwise | ||
| */ | ||
| fun currentSecurityStatusForUrl(context: Context, url: String): SecurityStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"for a given url" where you provide the url shouldn't exist when it is an extension function on the class that holds the URLs. It should not be an extension function here, determine the url to check automatically, or allow you to pass an enum for internal/external/cloud.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You sent me a DM on Discord about creating a new UrlHelper class for this one. Feel free to experiment but please comment here once you decided whether to introduce that or keep this.
...src/main/kotlin/io/homeassistant/companion/android/webview/insecure/BlockInsecureFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/kotlin/io/homeassistant/companion/android/webview/insecure/BlockInsecureScreen.kt
Outdated
Show resolved
Hide resolved
| modifier = Modifier | ||
| .padding(all = 20.dp) | ||
| .size(120.dp), | ||
| imageVector = Icons.Default.Lock, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had some discussions about this on Discord. My vote is for mdi:lock-open-alert as you're talking about http(s) in the screen and users have been trained for open lock = http, closed lock = https in web browsers, so showing a closed lock because they are using http feels wrong.
build-logic/convention/src/main/kotlin/AndroidComposeConventionPlugin.kt
Show resolved
Hide resolved
app/src/main/kotlin/io/homeassistant/companion/android/webview/WebViewActivity.kt
Show resolved
Hide resolved
| val allowInsecureConnection = serverManager.integrationRepository( | ||
| presenter.getActiveServer(), | ||
| ).getAllowInsecureConnection() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be exposed via the presenter instead, the activity should try to avoid using repositories directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same feelings but we are already calling getServer removeServer that we shouldn't.
I'm going to move this to the presenter in any case.
bf162f7 to
91753f8
Compare
423e8ff to
7919d50
Compare
7919d50 to
fe0b2a9
Compare
Summary
Add a new screen on top of the WebViewActivity that prevents loading the URL if we are in an insecure state and the user picked the
Most securedoption. This screen change based on the current state and can display banner with button to help the user 'fix' the situation.Checklist
Screenshots
Any other notes
The screen doesn't refresh on its own.